Works only for id 0? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Works only for id 0? (
/showthread.php?tid=128916)
Works only for id 0? -
falor - 20.02.2010
Hey guys, i made a /park command for admins,
Код:
if(strcmp(cmdtext, "/park", true) == 0)
{
if(PlayerInfo[playerid][admin] == 0) {
SendClientMessage(playerid, COLOR_GREY, "You're not an admin");
return 1;
}
if(PlayerInfo[playerid][faction] != 8) {
SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic");
return 1;
}
SetTimer("park", 800, false);
return 0;
}
Код:
public park(playerid)
{
if(PlayerInfo[playerid][logged] == 0) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be connected");
return 1;
}
if(PlayerInfo[playerid][jailed] == 1) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail.");
return 1;
}
if(VehicleInfo[GetPlayerVehicleID(playerid)][buybar] == 1) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "This vehicle is unbuyable");
return 1;
}
if(PlayerInfo[playerid][admin] == 0) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You're no an admin!");
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
new Float:spx,Float:spy,Float:spz;
new Float:spa;
GetVehiclePos(GetPlayerVehicleID(playerid),spx,spy,spz);
GetVehicleZAngle(GetPlayerVehicleID(playerid),spa);
VehicleInfo[GetPlayerVehicleID(playerid)][x_spawn] = spx;
VehicleInfo[GetPlayerVehicleID(playerid)][y_spawn] = spy;
VehicleInfo[GetPlayerVehicleID(playerid)][z_spawn] = spz;
VehicleInfo[GetPlayerVehicleID(playerid)][za_spawn] = spa;
format(securemess,sizeof(securemess),"You just parked %s's vehicle here",VehicleInfo[GetPlayerVehicleID(playerid)][owner]);
SendClientMessage(playerid, COLOR_GREEN, securemess);
return 1;
}
else {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not in a vehicle");
return 1;
}
}
But the command /park works only for the ID 0.
If i am ID 1, and type : /park
I have no response from the server (no text message, and it doesn't work)
But if i'm ID 0, i have the message, and it works!
Any ideas?
Thanks
Re: Works only for id 0? -
smeti - 20.02.2010
pawn Код:
SetTimer("park", 800, false); // Not playerid parameter public park(playerid);
pawn Код:
SetTimerEx("park", 800, false, "d", playerid);
Re: Works only for id 0? -
falor - 20.02.2010
Thank you i'll try