06.04.2010, 07:39
OK so i make like
Now how do i add to command so that turns to like 1, or 0 when you do the command?
Код:
new seatbelton;
Код:
new seatbeltoff;
new seatbelton;
new seatbeltoff;
new seatbelt[MAX_PLAYERS]; //We can set it to 1 when he has it on, and to 0 when he has it off. [MAX_PLAYERS] means that everyone can use the seatbelt command without interfering with others.
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmdtext,"/seatbelt",true) == 0)
{
if(IsPlayerInAnyVehicle(playerid)) //Checks if the player actually is in a vehicle
{
if(seatbelt[playerid] == 0) //Checks if our seatbelt variable is 0 (Put off)
{
seatbelt[playerid] = 1;
SendClientMessage(playerid,0xE2C063FF,"You have put your seatbelt on.");
}
else //If he already has his seatbelt on (in this case, 'else' means 'if the player has his seatbelt on already'
{
seatbelt[playerid] = 0;
SendClientMessage(playerid,0xE2C063FF,"You have put your seatbelt off.");
}
}
else SendClientMessage(playerid,0xE2C063FF,"You aren't in any vehicle!");
return 1;
}
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
seatbelt[playerid] = 0; //He just enters it.
SendClientMessage(playerid,0xE2C063FF,"To put your seatbelt on, type /seatbelt.");
return 1;
}
public OnPlayerExitVehicle(playerid,vehicleid)
{
if(seatbelt[playerid] == 1)
{
seatbelt[playerid] = 0; //You can't take a seatbelt with you when you exit, right?
SendClientMessage(playerid,0xE2C063FF,"You have exited your vehicle and put your seatbelt off.");
}
return 1;
}
if(IsPlayerInAnyVehicle(playerid));
error message: "error 036: empty statement"
Originally Posted by Steven82
Thanks man, apperate tht.
** I get some error's when doing this i edited this code out a little but one error i can't fix is that is is saying Код:
if(IsPlayerInAnyVehicle(playerid)); Код:
error message: "error 036: empty statement" ** Nevermind fixed it. |
Originally Posted by Steven82
Nope, the command was coding was completly bugged, maybe we should just looks at a FS and learn from it.
|
Originally Posted by Steven82
Thanks man, apperate tht.
** I get some error's when doing this i edited this code out a little but one error i can't fix is that is is saying Код:
if(IsPlayerInAnyVehicle(playerid)); Код:
error message: "error 036: empty statement" ** Nevermind fixed it. |