SA-MP Forums Archive
Job money - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Job money (/showthread.php?tid=597753)



Job money - sKenzi1996 - 04.01.2016

Hello.
I made a simple script of a job. I putted a car for job, i made some checkpoints, i putted a random money but how can i make after the checkpoints are done to say something like that " sKenzi1996, you earned %d$ from Garbage Man job. "
I know i have to do a string, i have searched on wiki samp but i found nothin'. A little help please?


Re: Job money - Lucky13 - 04.01.2016

When the player enters the last checkpoint:

Код:
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string), "{58FF0A}%s{FFFFFF}, you have earned {58FF0A}%d$ {FFFFFF}for completing the joob.",pName,randommoney);
SendClientMessage(playerid,-1,string);
randommoney = the money you said the player receives randomly.


Re: Job money - sKenzi1996 - 04.01.2016

Код:
new randommoney;
Код:
   
 if(CPGun[playerid] == 1) 
    {
        GivePlayerMoney(playerid, randommoney(1000) + 1000);
        DisablePlayerCheckpoint(playerid); 
        CPGun[playerid] = 2; 
        SetPlayerCheckpoint(playerid, 1358.7355,263.9266,19.5547, 3.0); 
        SendClientMessage(playerid, -1, "Job: Ai primit 500$ pentru c-ai preluat gunoiul, du-te la celalalt checkpoint.");
        return 1;
    }
    if(CPGun[playerid] == 2) 
    {
       GivePlayerMoney(playerid, randommoney(1000) + 1000);
        DisablePlayerCheckpoint(playerid); 
        CPGun[playerid] = 3;
        SetPlayerCheckpoint(playerid, 2045.4828,1386.7408,10.6719, 3.0); 
        SendClientMessage(playerid, -1, "Job: Ai primit 500$ pentru c-ai preluat gunoiul, du-te la celalalt checkpoint.");
        return 1;
    }
	 if(CPGun[playerid] == 3)
    {
		GivePlayerMoney(playerid, randommoney(1000) + 1000);
		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, -1, "Job: Munca s-a terminat, ai acumulat 1,500$.");
  		new pName[MAX_PLAYER_NAME], string[128];
		GetPlayerName(playerid,pName,sizeof(pName));
		format(string,sizeof(string), "{58FF0A}%s{FFFFFF}, you have earned {58FF0A}%d$ {FFFFFF}for completing the joob.",pName,randommoney);
		SendClientMessage(playerid,-1,string);
        return 1;
    }
And the errors:

Код:
D:\Samp\gamemodes\skenzi.pwn(97) : warning 213: tag mismatch
D:\Samp\gamemodes\skenzi.pwn(184) : error 012: invalid function call, not a valid address
D:\Samp\gamemodes\skenzi.pwn(184) : warning 215: expression has no effect
D:\Samp\gamemodes\skenzi.pwn(184) : error 001: expected token: ";", but found ")"
D:\Samp\gamemodes\skenzi.pwn(184) : error 029: invalid expression, assumed zero
D:\Samp\gamemodes\skenzi.pwn(184) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
What's the problem?


Re: Job money - Riddick94 - 04.01.2016

Quote:
Originally Posted by sKenzi1996
Посмотреть сообщение
What's the problem?
Код:
error 001: expected token: ";", but found ")"
That's your problem. Seek for it in that code, we have no clue where line 184 is.


Re: Job money - Lucky13 - 04.01.2016

I think this is the error:

Код:
if(CPGun[playerid] == 3)
    {
		GivePlayerMoney(playerid, randommoney(1000) + 1000);
		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, -1, "Job: Munca s-a terminat, ai acumulat 1,500$.");
  		new pName[MAX_PLAYER_NAME], string[128];
		GetPlayerName(playerid,pName,sizeof(pName));
		format(string,sizeof(string), "{58FF0A}%s{FFFFFF}, you have earned {58FF0A}%d$ {FFFFFF}for completing the joob.",pName,randommoney);
		SendClientMessage(playerid,-1,string);
        return 1;
    }
Make it like this:

Код:
if(CPGun[playerid] == 3)
    {
                randommoney=random(1000)+1001;
		GivePlayerMoney(playerid, randommoney);
		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, -1, "Job: Munca s-a terminat, ai acumulat 1,500$.");
  		new pName[MAX_PLAYER_NAME], string[128];
		GetPlayerName(playerid,pName,sizeof(pName));
		format(string,sizeof(string), "{58FF0A}%s{FFFFFF}, you have earned {58FF0A}%d$ {FFFFFF}for completing the joob.",pName,randommoney);
		SendClientMessage(playerid,-1,string);
        return 1;
    }



Re: Job money - sKenzi1996 - 04.01.2016

Lucky13, i just pasted your code to CPGun 3. It's all right, i think. The problem is:
- That string doesn't show me the correct amount of cash earned. For exemple i earned 573$ and in the string, at the last CP said " 197$ ". - http://i.imgur.com/s8f1Vh6.png

- How can i put at each CP a message with " You earned %d from this checkpoint "?
I've tried with:
Код:
randommoney=random(100)+101;
GivePlayerMoney(playerid, randommoney);
But in SCM showed me " 1178088827 $ "


Re: Job money - Lucky13 - 05.01.2016

Код:
if(CPGun[playerid] == 1) 
    {
        GivePlayerMoney(playerid, 500);
        DisablePlayerCheckpoint(playerid); 
        CPGun[playerid] = 2; 
        SetPlayerCheckpoint(playerid, 1358.7355,263.9266,19.5547, 3.0); 
        SendClientMessage(playerid, -1, "Job: Ai primit 500$ pentru ca ai preluat gunoiul, du-te la celalalt checkpoint.");
        return 1;
    }
    if(CPGun[playerid] == 2) 
    {
       GivePlayerMoney(playerid, 500);
        DisablePlayerCheckpoint(playerid); 
        CPGun[playerid] = 3;
        SetPlayerCheckpoint(playerid, 2045.4828,1386.7408,10.6719, 3.0); 
        SendClientMessage(playerid, -1, "Job: Ai primit 500$ pentru c-ai preluat gunoiul, du-te la celalalt checkpoint.");
        return 1;
    }
	 if(CPGun[playerid] == 3)
    {
		randommoney=random(1000)+2001;
		GivePlayerMoney(playerid, randommoney);
		DisablePlayerCheckpoint(playerid);
  		new pName[MAX_PLAYER_NAME], string[128];
		GetPlayerName(playerid,pName,sizeof(pName));
		format(string,sizeof(string), "Job: {58FF0A}%s{FFFFFF}, ai acumulat {58FF0A}%d$ {FFFFFF}pentru ca ai terminat misiunea de gunoier.",pName,randommoney);
		SendClientMessage(playerid,-1,string);
        return 1;
    }
OT: Ai noroc ca sunt roman ) primele 2 checkpoint-uri iti da 500$ iar al treilea iti da o suma la intamplare ( care poate fi maxim 1.000$ ) + 1.000$ + 1.000$ ( de la primele 2 checkpoints )


Re: Job money - Godey - 05.01.2016

Quote:
Originally Posted by sKenzi1996
Посмотреть сообщение
Код:
new randommoney;
Код:
D:\Samp\gamemodes\skenzi.pwn(97) : warning 213: tag mismatch
D:\Samp\gamemodes\skenzi.pwn(184) : error 012: invalid function call, not a valid address
D:\Samp\gamemodes\skenzi.pwn(184) : warning 215: expression has no effect
D:\Samp\gamemodes\skenzi.pwn(184) : error 001: expected token: ";", but found ")"
D:\Samp\gamemodes\skenzi.pwn(184) : error 029: invalid expression, assumed zero
D:\Samp\gamemodes\skenzi.pwn(184) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
What's the problem?
We don't know what's in LINE 184 & 97!
Paste that Line CMD here


Re: Job money - sKenzi1996 - 05.01.2016

I've solved that problem with money. Thank you!
- Lucky13, daca nu erai roman, era vreo problema? )