if(strcmp(cmd, "/drag", true) == 0)
{
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_COP) {
SendClientMessage(playerid,COLOR_ERROR,"You are not part of the SWAT team. Only SWAT 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;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /drag (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid)) {
format(szstring, sizeof(szstring), "ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
GetPlayerName(playerid,oname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /drag (id) ID Must be a number");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 4) {
format(szstring, sizeof(szstring), "%s(%d) Is not close enough you cannot drag that player",pname, giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
if(Jailed[giveplayerid] == 1) {
format(szstring, sizeof(szstring), "%s(%d) Is in jail. You cannot drag a prisoner",pname, giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid, COLOR_ERROR, "You are in a vehicle. You must be on foot to drag");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid)) {
SendClientMessage(playerid, COLOR_ERROR, "That player is already in a vehicle");
return 1;
}
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_DRAGGED_|");
format(szstring, sizeof(szstring), "%s(%d): has dragged you,use /breakcuffs to attempt an escape!",oname, playerid);
SendClientMessage(giveplayerid, COLOR_DODGERBLUE, szstring);
TogglePlayerControllable(giveplayerid, 0);
isKidnapped[giveplayerid] =1;
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Criminal Dragged|");
format(szstring, sizeof(szstring), "You have grabbed %s(%d) and thrown him into your car!", pname, giveplayerid);
SendClientMessage(playerid, COLOR_DODGERBLUE, szstring);
format(szstring, sizeof(szstring), "%s(%d) has grabbed %s(%d) and thrown him into his car!",oname,playerid,pname,giveplayerid);
SendClientMessageToAll(0x00C7FFAA, szstring);
PutPlayerInVehicle(giveplayerid,KidCar[playerid],1);
HasKidnapped[playerid] =1;
format(szstring, sizeof(szstring), "~r~DRAGGED BY SWAT MEMBER~n~~w~%s(%d)",oname,playerid);
GameTextForPlayer(giveplayerid,szstring,5000,3);
return 1;
}
new KidCar[MAX_PLAYERS];
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER && gTeam[playerid] == TEAM_KIDNAPPER)
{
KidCar[playerid] = GetPlayerVehicleID(playerid);
}
#define INVALID_VEHICLE_ID 500
new gLastCar[MAX_PLAYERS];
public OnPlayerExitVehicle(playerid, vehicleid)
{
gLastCar[playerid] = vehicleid;
return 1;
}
if(gLastCar[playerid] == INVALID_VEHICLE_ID) {
// do something here
return 1;
}
if(gLastCar[playerid] == INVALID_VEHICLE_ID) {
SendClientMessage(playerid, COLOR_ERROR, "You must have a vehicle before using this command!");
return 1; }
PutPlayerInVehicle(giveplayerid,KidCar[playerid],1);
PutPlayerInVehicle(giveplayerid,gLastCar[playerid],1);
Originally Posted by Antonio (eternalrp.webatu.com)
Sorry, that means its already defined. Remove that line then.
|
gLastCar[playerid] = INVALID_VEHICLE_ID;
Originally Posted by Antonio (eternalrp.webatu.com)
Can you show the command you have right now?
EDIT: Add under OnPlayerConnect pawn Код:
|
if(gLastCar[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You must have a vehicle before using this command!");
return 1;
}