SA-MP Forums Archive
Stock - 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: Stock (/showthread.php?tid=357993)



Stock - Chris1337 - 09.07.2012

pawn Код:
stock GivePlayerRobberyAmount(playerid, amount , stars, place)
{
    SetPlayerWantedLevel(playerid, stars);
    GivePlayerMoney(playerid, amount);
    return 1;
}
I Want to make something like you can see the playerid, the amount of cash , the stars and this is what i want :

place (as defined on stock) would be a string , how can i make that?

like
pawn Код:
stock GivePlayerRobberyAmount(playerid, amount, stars, place[])
{
       new place[250];
    SetPlayerWantedLevel(playerid, stars);
    GivePlayerMoney(playerid, amount);
    place = "Cluckin Bell"; // Example
    return 1;
}
Is this correct?


Re: Stock - [KHK]Khalid - 09.07.2012

Why the length 250 I believe there is no place with that too damn long name. 64 or even 32 are enough for a place name I guess.

Edit:

Oops
Check this

pawn Код:
// Somewhere you used GivePlayerRobberyAmount like this

GivePlayerRobberyAmount(playerid, 1000, 2, "Cluckin Bell");

// the stock
stock GivePlayerRobberyAmount(playerid, amount, stars, place[])
{
    SetPlayerWantedLevel(playerid, stars);
    GivePlayerMoney(playerid, amount);
    // Example to send a message to all that the place has been robbed with info
    new str[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s has stolen %d from %s and has %d stars now!", name, amount, place, stars);
    SendClientMessageToAll(-1, str);
    return 1;
}



Re: Stock - CmZxC - 09.07.2012

as for this line
pawn Код:
SetPlayerWantedLevel(playerid, stars);
you are setting his wanted level, what i suggest is
pawn Код:
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+stars);
to add wanted level not set it.


Re: Stock - Chris1337 - 09.07.2012

Oh ye


Re: Stock - Chris1337 - 09.07.2012

oh and

pawn Код:
C:\Users\Usuario\Desktop\Projects\CS\gamemodes\GTACNR.pwn(93) : error 010: invalid function or declaration
C:\Users\Usuario\Desktop\Projects\CS\gamemodes\GTACNR.pwn(1493) : error 035: argument type mismatch (argument 3)
pawn Код:
Line 93: Stock GivePlayerRobberyAmount(playerid, amount, stars, place[])

1493:  GivePlayerRobberyAmount(playerid, 1000, 2, "Cluckin Bell");