SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/04/2013, 02:08 PM   #1
BossZk
Big Clucker
 
Join Date: Mar 2013
Posts: 95
Reputation: 2
Default Dynamic Cps with command to rob

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
BossZk is offline   Reply With Quote
Old 02/05/2013, 03:09 AM   #2
BossZk
Big Clucker
 
Join Date: Mar 2013
Posts: 95
Reputation: 2
Default Re: Dynamic Cps with command to rob

no help
BossZk is offline   Reply With Quote
Old 02/05/2013, 03:24 AM   #3
vvhy
Big Clucker
 
Join Date: Mar 2012
Posts: 145
Reputation: 11
Default Re: Dynamic Cps with command to rob

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;
}
__________________
My work:
__________________________________________________ ______
MAPS

House Interior
Bank Interior
vvhy is offline   Reply With Quote
Old 02/05/2013, 04:17 AM   #4
BossZk
Big Clucker
 
Join Date: Mar 2013
Posts: 95
Reputation: 2
Default Re: Dynamic Cps with command to rob

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
BossZk is offline   Reply With Quote
Old 02/05/2013, 04:32 AM   #5
vvhy
Big Clucker
 
Join Date: Mar 2012
Posts: 145
Reputation: 11
Default Re: Dynamic Cps with command to rob

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);
}
__________________
My work:
__________________________________________________ ______
MAPS

House Interior
Bank Interior
vvhy is offline   Reply With Quote
Old 02/05/2013, 05:30 AM   #6
BossZk
Big Clucker
 
Join Date: Mar 2013
Posts: 95
Reputation: 2
Default Re: Dynamic Cps with command to rob

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
BossZk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic CP's Dan. Scripting Help 6 22/07/2012 08:07 PM
3dtextlabel dynamic or not dynamic help! Dubbystep Scripting Help 0 05/02/2012 04:19 PM
Dynamic /setspawn command Wennicke Scripting Help 2 28/11/2011 05:30 PM
Dynamic /spawncar command Ritchie999 Help Archive 0 18/10/2010 11:51 PM


All times are GMT. The time now is 07:37 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.