16.05.2013, 23:50
This system is Change Vehicle Color
Код:
#include <a_samp> new gDisco[MAX_VEHICLES],gTimer[MAX_PLAYERS]; public OnPlayerCommandText(playerid, cmdtext[]) { new v = GetPlayerVehicleID(playerid); if(strcmp("/Disco", cmdtext, true, 10) == 0) { gDisco[v] = gDisco[v]? 1:0; if(!IsPlayerInAnyVehicle(v))return SendClientMessage(playerid,-1,"u not in vehicle"); else gDisco[v] = 1; Disco(v); return 1; } return 0; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(gDisco[vehicleid] == 1)return SendClientMessage(playerid,0xFFFFFAA,"in this vehicle the disco sys is open"); return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { if(gDisco[vehicleid] == 1)return SendClientMessage(playerid,0xFFFFFAA,"u exit from your vehicle and the disco is open"); return 1; } Disco(vehicleid) { if(gDisco[vehicleid] == 0)return 0; else KillTimer(gTimer[playerid]); gTimer[playerid] = SetTimerEx("Disco",1000,1,"d",vehicleid); ChangeVehicleColor(vehicleid,random(255),random(255)); return 1; }