18.02.2009, 16:03
Hey Guys , I need some help with scripting.
I wanna put on all cars Security system , DOes anyone know how?
I wanna put on all cars Security system , DOes anyone know how?
Originally Posted by Allan
As posting random "OnPlayerCommandText" is frowned upon in the Useful Functions topic, I thought I'd make a topic for posting some fun/useful/Downright useless functions to add to your OnPlayerCommandText script!
For those in need of it: strtok: Код:
strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } /lock: Locks Car Doors
Код:
if (strcmp(cmdtext, "/lock", true)==0) { if(IsPlayerInAnyVehicle(playerid)) { State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,COLOR_GREY,"You can only lock the doors as the driver."); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { if(i != playerid) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1); } } SendClientMessage(playerid, COLOR_GREY, "Vehicle locked!"); GetPlayerPos(playerid,X,Y,Z); PlayerPlaySound(playerid,1056,X,Y,Z); } else { SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle!"); } return 1; } /unlock: Unlocks Car Doors
Код:
if (strcmp(cmdtext, "/unlock", true)==0) { if(IsPlayerInAnyVehicle(playerid)) { State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,COLOR_GREY,"You can only unlock the doors as the driver."); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0); } SendClientMessage(playerid, COLOR_GREY, "Vehicle unlocked!"); GetPlayerPos(playerid,X,Y,Z); PlayerPlaySound(playerid,1057,X,Y,Z); } else { SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle!"); } return 1; } |