20.10.2009, 21:19
i want to make a command that drags someone in the car so they could be turned in to the cops
heres what i have but it doesnt work
heres what i have but it doesnt work
Код:
{ if(IsSpawned[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command"); return 1; } if(Jailed[playerid] ==1) { SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail"); return 1; } if(gTeam[playerid] != TEAM_ARMY) { SendClientMessage(playerid,COLOR_ERROR,"You are not a Military Offical. Only Military Officals can use this command"); return 1; } if(InDerby[playerid] == 1) { SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium"); return 1; } if(HasKidnapped[playerid] == 1) { SendClientMessage(playerid,COLOR_ERROR,"You already have a person detained"); return 1; } if(gTeam[playerid] == TEAM_COP) { SendClientMessage(playerid,COLOR_ERROR,"Law Enforcement agents cannot detain people"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /detain (id)"); return 1; } if(cuffed[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "Player is not cuffed"); return 1; } giveplayerid = strval(tmp); if(!IsPlayerConnected(giveplayerid)) { format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); return 1; } new oname[24]; new pname[24]; GetPlayerName(playerid,oname, 24); GetPlayerName(giveplayerid, pname, 24); if(!IsNumeric(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /detain (id) ID Must be a number"); return 1; } if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 4) { format(string, sizeof(string), "%s(%d) Is not close enough you cannot detain that player",pname, giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); return 1; } if(InAdminMode[giveplayerid] == 1337) { format(string, sizeof(string), "%s(%d) Is a server Admin. He / She is in Admin Mode. You cannot use this command on this player at this time",pname, giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); format(string, sizeof(string), "(ADMIN MODE) %s(%d) Has attempted to detain you . You are in Admin mode. You cannot be detained",oname,playerid); SendClientMessage(giveplayerid, 0xFF7F50AA, string); return 1; } if(Jailed[giveplayerid] == 1) { format(string, sizeof(string), "%s(%d) Is in jail. You cannot detain a prisoner",pname, giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_ERROR, "You are in a vehicle"); return 1; } if(IsPlayerInAnyVehicle(giveplayerid)) { SendClientMessage(playerid, COLOR_ERROR, "That player is already in a vehicle"); return 1; } SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Detained_|"); format(string, sizeof(string), "%s(%d): has Detained you,use /breakcuffs to attempt an escape!",oname, playerid); SendClientMessage(giveplayerid, COLOR_DODGERBLUE, string); TogglePlayerControllable(giveplayerid, 0); isKidnapped[giveplayerid] =1; oscore = GetPlayerScore(playerid); SetPlayerScore(playerid, oscore +4); gotRope[playerid] =1; SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspected Detained_|"); format(string, sizeof(string), "You have Detained %s(%d).Drive to the pd to turn him in", pname, giveplayerid); SendClientMessage(playerid, COLOR_DODGERBLUE, string); format(string, sizeof(string), "(Detaining) %s(%d) has grabbed %s(%d) and thrown him into his car!",oname,playerid,pname,giveplayerid); SendClientMessageToAll(0x00C7FFAA, string); PutPlayerInVehicle(giveplayerid,KidCar[playerid],1); HasKidnapped[playerid] =1; new plwl = GetPlayerWantedLevel(playerid); new pcol = GetPlayerColor(playerid); SetPlayerWantedLevel(playerid,plwl +0); plwl = GetPlayerWantedLevel(playerid); SendClientMessage(playerid, 0xA9A9A9AA, "|_Detaining_|"); SendClientMessage(playerid,pcol,string); format(string, sizeof(string), "~r~DETAINED BY~n~~w~%s(%d)",oname,playerid); GameTextForPlayer(giveplayerid,string,5000,3); new current_zone; current_zone = player_zone[playerid]; for(new i=0;i<MAX_PLAYERS;i++) { if(LawEnforcementRadio[i] == 1) { format(string, sizeof(string), "DISPATCH: (DETAINING) Officer: %s(%d) has detained %s(%d) Location: %s",oname,playerid,pname,giveplayerid,zones[current_zone][zone_name]); SendClientMessage(i,COLOR_ROYALBLUE,string); } } } return 1; }