public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME];
new
Float:fPos[ 3 ],
Interior;
new file[128];
GetPlayerName( playerid, name, MAX_PLAYER_NAME );
format( file, sizeof( file ), \"pos/%s.ini\", name );
if( dini_Exists( file ) )
{
fPos[ 0 ] = dini_Float( file, \"KooX\" );
fPos[ 1 ] = dini_Float( file, \"KooY\" );
fPos[ 2 ] = dini_Float( file, \"KooZ\" );
Interior = dini_Int(file, \"KooI\");
SetPlayerPos( playerid, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
SetPlayerInterior(playerid, Interior);
}
else
{
SetPlayerPos( playerid, //ahol kezd);
SetPlayerInterior(playerid, 0);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME];
new
Float:fPos[ 3 ],
Interior;
Interior = GetPlayerInterior(playerid);
GetPlayerPos( playerid, fPos[ 0 ], fPos[ 1 ], fPos[ 2 ] );
GetPlayerName( playerid, name, MAX_PLAYER_NAME );
format( file, sizeof( file ), \"pos/%s.ini\", name );
if( !dini_Exists( file ) )
{
dini_Create( file );
dini_FloatSet(file, \"KooX\", fPos[ 0 ] );
dini_FloatSet(file, \"KooY\", fPos[ 1 ] );
dini_FloatSet(file, \"KooZ\", fPos[ 2 ] );
dini_IntSet(file, \"KooI\", Interior);
}
else
{
dini_FloatSet(file, \"KooX\", fPos[ 0 ] );
dini_FloatSet(file, \"KooY\", fPos[ 1 ] );
dini_FloatSet(file, \"KooZ\", fPos[ 2 ] );
dini_IntSet(file, \"KooI\", Interior);
}
return 1;
}
kösz,amit leirtam megbirod csinálni? :D
Itt van a cuccosod. (1x használható parancs belépéskor/kilépéskor)
new bool:Parancs;
public OnPlayerConnect(playerid)
{
Parancs = true;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/parancs\", cmdtext, true, 10) == 0)
{
if(Parancs == true)
{
SendClientMessage(playerid,COLOR_YELLOW, \"Mostantól nem tudod használni ezt a parancsot, csak relog után.\");
Parancs = false;
}
else
{
SendClientMessage(playerid,-1,\"Te már használtad ezt a parancsot! Relogolj!\");
}
return 1;
}
Szerintem jó.
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/parancs\", cmdtext, true, 10) == 0)
{
if(Parancs == true)
{
SendClientMessage(playerid,COLOR_YELLOW, \"Mostantól nem tudod használni ezt a parancsot, csak relog után.\");
Parancs = false;
}
else
{
SendClientMessage(playerid,-1,\"Te már használtad ezt a parancsot! Relogolj!\");
}
return 1;
}
[/quote]
Rövidítve:
if (strcmp(\"/parancs\", cmdtext, true, 10) == 0)
{
if(Parancs == false) return SendClientMessage(playerid,-1,\"Te már használtad ezt a parancsot! Relogolj!\");
SendClientMessage(playerid,COLOR_YELLOW, \"Mostantól nem tudod használni ezt a parancsot, csak relog után.\");
Parancs = false;
return 1;
}
Nem kell összezavarni az \'{, }, else\' meg ezekkel.
Hülye megoldás,mert restart után újra használhatja..
#define File \"parancshaszn.ini\"
CMD:parancs(playerid,params[])
{
if(!dini_Exists(File))
{
dini_Create(File);
dini_IntSet(File,\"Parancs1\",1);
}
else if(dini_Int(File,\"Parancs1) <= 0)
{
dini_IntSet(File,\"Parancs1\",1);
}
else if(dini_Int(File,\"Parancs1\") >= 1) return SendClienMessage(playerid,0xffffaa,\"Már használták ezt a parancsot!\");
return 1;
}