Dynamic Cps with command to rob
#1

Code:
CMD:robstore(playerid,params[])
{
    if(!IsPlayerInCheckpoint(playerid)) {
		SendClientMessage(playerid, COLOR_ERROR, "You are not in the checkpoint!");
		return 1;
	}
	if(gTeam[playerid] == POLICE || gTeam[playerid] == SWAT || gTeam[playerid] == ARMY )
		return SendClientMessage(playerid, COLOR_ERROR, "You cannot rob anything.");
	if(GetPVarInt(playerid, "RobbedRecently") > 1)
		return SendClientMessage(playerid, COLOR_ERROR, "You have robbed a store recently. Please wait.");
	new string[120];
	new crand = random(100);
  	if(checkpointid == Checkpoint[1])
	{
		if(crand < 10)
		{
		    SetPVarInt(playerid, "RobbedRecently", 65);
		    SetGVarInt("PizzaRobbed", 60);
		    return SendClientMessage(playerid, COLOR_ERROR, "Robbery failed.");
		}
		if(GetGVarInt("PizzaRobbed") > 1) return SendClientMessage(playerid, COLOR_ERROR, "The Well Stacked Pizza has been robbed recently.");
		format(string, 120, "[ROBBERY] %s has started a robbery at the Well Stacked Pizza", playerid);
		SendClientMessageToAll(SWAT_COLOUR, string);
		format(string, 120, "[DISPATCH] %s has started a robbery at the Well Stacked Pizza", playerid);
		SendCopMessage(string);
		SetPVarInt(playerid, "RobbingPizza", 15);
		SetPVarInt(playerid, "RobbedRecently", 120);
		SetGVarInt("PizzaRobbed", 120);
		SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+4);
		return 1;
	}
	return 1;
}
Code:
C:\Users\****\Desktop\samp\gamemodes\boss.pwn(716) : error 017: undefined symbol "checkpointid"
Could someone help me fix this
Reply
#2

no help
Reply
#3

Try this, I think it should work for the gamemode you are using.

pawn Code:
CMD:robstore(playerid,params[])
{
    if(!IsPlayerInCheckpoint(playerid)) {
        SendClientMessage(playerid, COLOR_ERROR, "You are not in the checkpoint!");
        return 1;
    }
    if(gTeam[playerid] == POLICE || gTeam[playerid] == SWAT || gTeam[playerid] == ARMY )
        return SendClientMessage(playerid, COLOR_ERROR, "You cannot rob anything.");
    if(GetPVarInt(playerid, "RobbedRecently") > 1)
        return SendClientMessage(playerid, COLOR_ERROR, "You have robbed a store recently. Please wait.");
    new string[120];
    new crand = random(100);
        if(IsPlayerInDynamicCP(playerid,Checkpoint[1]))
    {
        if(crand < 10)
        {
            SetPVarInt(playerid, "RobbedRecently", 65);
            SetGVarInt("PizzaRobbed", 60);
            return SendClientMessage(playerid, COLOR_ERROR, "Robbery failed.");
        }
        if(GetGVarInt("PizzaRobbed") > 1) return SendClientMessage(playerid, COLOR_ERROR, "The Well Stacked Pizza has been robbed recently.");
        format(string, 120, "[ROBBERY] %s has started a robbery at the Well Stacked Pizza", playerid);
        SendClientMessageToAll(SWAT_COLOUR, string);
        format(string, 120, "[DISPATCH] %s has started a robbery at the Well Stacked Pizza", playerid);
        SendCopMessage(string);
        SetPVarInt(playerid, "RobbingPizza", 15);
        SetPVarInt(playerid, "RobbedRecently", 120);
        SetGVarInt("PizzaRobbed", 120);
        SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+4);
        return 1;
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by vvhy
View Post
Try this, I think it should work for the gamemode you are using.

pawn Code:
CMD:robstore(playerid,params[])
{
    if(!IsPlayerInCheckpoint(playerid)) {
        SendClientMessage(playerid, COLOR_ERROR, "You are not in the checkpoint!");
        return 1;
    }
    if(gTeam[playerid] == POLICE || gTeam[playerid] == SWAT || gTeam[playerid] == ARMY )
        return SendClientMessage(playerid, COLOR_ERROR, "You cannot rob anything.");
    if(GetPVarInt(playerid, "RobbedRecently") > 1)
        return SendClientMessage(playerid, COLOR_ERROR, "You have robbed a store recently. Please wait.");
    new string[120];
    new crand = random(100);
        if(IsPlayerInDynamicCP(playerid,Checkpoint[1]))
    {
        if(crand < 10)
        {
            SetPVarInt(playerid, "RobbedRecently", 65);
            SetGVarInt("PizzaRobbed", 60);
            return SendClientMessage(playerid, COLOR_ERROR, "Robbery failed.");
        }
        if(GetGVarInt("PizzaRobbed") > 1) return SendClientMessage(playerid, COLOR_ERROR, "The Well Stacked Pizza has been robbed recently.");
        format(string, 120, "[ROBBERY] %s has started a robbery at the Well Stacked Pizza", playerid);
        SendClientMessageToAll(SWAT_COLOUR, string);
        format(string, 120, "[DISPATCH] %s has started a robbery at the Well Stacked Pizza", playerid);
        SendCopMessage(string);
        SetPVarInt(playerid, "RobbingPizza", 15);
        SetPVarInt(playerid, "RobbedRecently", 120);
        SetGVarInt("PizzaRobbed", 120);
        SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+4);
        return 1;
    }
    return 1;
}
Compiled with no errors but, i dont get any money from the robbery and when i do rob it, i cant rob it again because it keeps saying robbed recently even after awhile
Reply
#5

Put this under your
pawn Code:
public Server()
pawn Code:
if(GetPVarInt(i, "RobbingPizza") == 1)
{
    new string[120]; new pname[24]; GetPlayerName(i, pname, 24);
    new rand = random(500000);
    format(string, 120, "[ROBBERY] %s(%d) has robbed $%d from the Well Stacked Pizza.", pname, i, rand);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
    IRC_Say(gGroupID, IRC_CHANNEL, string);
    GivePlayerMoney(i, rand); IncreaseWantedLevel(i, 6); IncreaseScore(i, 3);
    format(string, 120, "[DISPATCH] %s(%d) has robbed the Well Stacked Pizza. Respond now.", pname, i);
    SendCopMessage(string);
    format(string, 120, "Type /radiooff to turn your radio off and stop recieving alerts.");
    SendCopMessage(string);
    SetPVarInt(i, "RobbingPizza", 0);
}
Reply
#6

Quote:
Originally Posted by vvhy
View Post
Put this under your
pawn Code:
public Server()
pawn Code:
if(GetPVarInt(i, "RobbingPizza") == 1)
{
    new string[120]; new pname[24]; GetPlayerName(i, pname, 24);
    new rand = random(500000);
    format(string, 120, "[ROBBERY] %s(%d) has robbed $%d from the Well Stacked Pizza.", pname, i, rand);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
    IRC_Say(gGroupID, IRC_CHANNEL, string);
    GivePlayerMoney(i, rand); IncreaseWantedLevel(i, 6); IncreaseScore(i, 3);
    format(string, 120, "[DISPATCH] %s(%d) has robbed the Well Stacked Pizza. Respond now.", pname, i);
    SendCopMessage(string);
    format(string, 120, "Type /radiooff to turn your radio off and stop recieving alerts.");
    SendCopMessage(string);
    SetPVarInt(i, "RobbingPizza", 0);
}
i had already got it to work, thanks for your help anyways
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)