if(!strcmp(cmdtext, "/cb", true, 3)) { if(!cmdtext[3])return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /cb [Text]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "*(CB Radio)%s: %s", str, cmdtext[4]); SendClientMessageToAll(0x9ACD32AA, str); return 1; }
if(!strcmp(cmdtext, "/cb", true, 3)) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || (GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)) { if(!cmdtext[3])return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /cb [Text]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "*(CB Radio)%s: %s", str, cmdtext[4]); SendClientMessageToAll(0x9ACD32AA, str); } return 1; }
Originally Posted by KotZ
now this cmd can be used only in vehicle
Код:
if(!strcmp(cmdtext, "/cb", true, 3)) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || (GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)) { if(!cmdtext[3])return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /cb [Text]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "*(CB Radio)%s: %s", str, cmdtext[4]); SendClientMessageToAll(0x9ACD32AA, str); } return 1; } |
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || (GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)) { if(!cmdtext[3])return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /cb [Text]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "*(CB Radio)%s: %s", str, cmdtext[4]); SendClientMessageToAll(0x9ACD32AA, str); } else SendClientMessage(playerid, 0x9ACD32AA,"This command can only be used inside a vehicle.");
if(IsPlayerInAnyVehicle(playerid))
{
// player is in any vehicle, execute the other code..
}
else
{
// player is not in any vehicle, send him the message.
}