Kidnapp, PlayerInVehicle
#7

Quote:
Originally Posted by Ghett0
I THINK he means the ability to kidnap someone if they're in your car. You'll need strtok for this:

pawn Код:
if(strcmp(cmd, "/kidnap", true) == 0)
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000, "You must be in a vehicle to kidnap someone!");
    new KidnapID = strval(strtok(cmd, idx));
    if(!IsPlayerConnected(KidnapID) || IsNumeric(cmdtext)) return SendClientMessage(playerid, 0xFF0000, "That's an invalid ID.");
    if(!IsPlayerInVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, 0xFF0000, "That player isn't in your car.");
    if(random(10) == 1)
    new PName[MAX_PLAYER_NAME];
    new KidnapString[40];
    {
        SendClientMessage(playerid, 0xFFFF00, "The kidnap was successful.");
        GetPlayerName(playerid, PName, sizeof(PName));
        format(KidnapString, sizeof(KidnapString), "%s has kidnapped you!", PName);
        SendClientMessage(KidnapID, 0xFF0000, KidnapString);
    }
    else
    {
        GetPlayerName(KidnapID, PName, sizeof(PName));
        format(KidnapString, sizeof(KidnapString), The kidnap failed and %s noticed you tried to kidnap him!", PName);
        SendClientMessage(KidnapID, 0xFF0000, KidnapString);
        GetPlayerName(playerid, PName, sizeof(PName));
        format(KidnapString, sizeof(KidnapString), "
%s has attempted to kidnap you!", PName);
        SendClientMessage(KidnapID, 0xFF0000, KidnapString);   
    }
    return 1;
}
There's a 1/10 chance you'll successfully kidnap.
Hey man,
I take part of your code and put in my own way.
There's a little warning, check this out:

Код:
warning 202: number of arguments does not match definition
Follow the line, where is getting warning:

Код:
				if(!IsPlayerInVehicle(GetPlayerVehicleID(playerid))){
				  SendClientMessage(playerid, COLOR_YELLOW, "Message here");
				  return 1;
				}
You know what is?
Reply


Messages In This Thread
Kidnapp, PlayerInVehicle - by shark - 09.02.2009, 16:17
Re: Kidnapp, PlayerInVehicle - by Extrak - 09.02.2009, 16:59
Re: Kidnapp, PlayerInVehicle - by Danut - 09.02.2009, 17:34
Re: Kidnapp, PlayerInVehicle - by TheAngel105 - 09.02.2009, 19:14
Re: Kidnapp, PlayerInVehicle - by Ghett0 - 09.02.2009, 19:42
Re: Kidnapp, PlayerInVehicle - by shark - 09.02.2009, 20:58
Re: Kidnapp, PlayerInVehicle - by shark - 10.02.2009, 10:10
Re: Kidnapp, PlayerInVehicle - by Auto-Sized - 10.02.2009, 10:47
Re: Kidnapp, PlayerInVehicle - by shark - 10.02.2009, 11:11
Re: Kidnapp, PlayerInVehicle - by Ghett0 - 14.02.2009, 02:53

Forum Jump:


Users browsing this thread: 1 Guest(s)