public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (IsPlayerInVehicle(playerid, 573))
{
new name[ 24 ], string[ 64 ];
GetPlayerName( playerid, name, 24 );
format( string, sizeof(string), "~w~%s has stolen the car!", name );
GameTextForAll( string, 5000, 3 );
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetPlayerVehicleID(playerid) == 573))
{
new name[ 24 ], string[ 64 ];
GetPlayerName( playerid, name, 24 );
format( string, sizeof(string), "~w~%s has stolen the car!", name );
GameTextForAll( string, 5000, 3 );
}
return 1;
}
if (GetPlayerVehicleID(playerid) == 573))
error 029: invalid expression, assumed zero
Originally Posted by Shinzei_Banzai
pawn Код:
Код:
error 029: invalid expression, assumed zero |
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if (GetVehicleModel(vehicleid) == 573) { new name[ 24 ], string[ 64 ]; GetPlayerName( playerid, name, 24 ); format( string, sizeof(string), "~w~%s has stolen the car!", name ); GameTextForAll( string, 5000, 3 ); } return 1; }
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if (vehicleid == 573) { new name[ 24 ], string[ 64 ]; GetPlayerName( playerid, name, 24 ); format( string, sizeof(string), "~w~%s has stolen the car!", name ); GameTextForAll( string, 5000, 3 ); } return 1; }
Originally Posted by Shinzei_Banzai
- Is it possible to disable a CMD by using another CMD?
|
Originally Posted by Don Correlli
Just set a variable in the command 1 and use the if-statement to check the variable in the command 2.
|
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/disable", cmdtext, true, 10) == 0)
{
SetCMDStatus = Disabled;
}
else
{
SetCMDStatus = Enabled;
}
return 1;
}
if (strcmp("/teleporter", cmdtext, true, 10) == 0)
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,0x00FF00AA,"You're in a vehicle, get out of it first!");
}
else
{
SetPlayerPos(playerid,-119.5348,-368.5644,1.4297);
SendClientMessage(playerid,0x00FF00AA,"Shut up and listen to the admin!.");
return 1;
}
Originally Posted by Shinzei_Banzai
Quote:
|
new bool:myVariable = false;
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/mycommand1", true) == 0)
{
if(myVariable == false)
{
myVariable = true; // set variable to true.
}
else if(myVariable == true)
{
myVariable = false; // set variable to false.
}
return 1;
}
if(strcmp(cmdtext, "/mycommand2", true) == 0)
{
if(myVariable == true)
{
// myVariable is true, you can execute your code.
}
else if(myVariable == false)
{
// myVariable is NOT true (it's false), send message that user can't use this command.
}
return 1;
}
return 0;
}