A few questions about Pawno -
Mike97300 - 13.06.2012
Well, my first question is, how do I make it check if I have a cretin number variable for example
Код:
Crack[playerid] = 0;
Okay, I'm not sure if that's right or not, but is there a way to check if you have a certain amount? For example.
Код:
COMMAND:usecrack(playerid, params[])
{
if/*the number not being equal to one*/ SendClientMessage(playerid,COLOR_WHITE, "You don't have any crack!");
else
{
SetPlayerHealth(playerid,100);
return 1;
}
That's something that I just made real quick, if someone could help me or correct me, that would be appreciated.
Re: A few questions about Pawno -
ReneG - 13.06.2012
https://sampwiki.blast.hk/wiki/Control_Structures
@if statements.
Btw pawno is the editor. Pawn is the scripting language
Re: A few questions about Pawno -
Mike97300 - 13.06.2012
Okay, lets say when you buy crack you want to add one to the number, how would you do that?
And tell me if this is wrong.
Код:
crack = 0;
COMMAND:usecrack(playerid, params[])
{
if(!crack = 1) SendClientMessage(playerid,COLOR_WHITE, "You don't have any crack!");
else
{
SetPlayerHealth(playerid,100);
return 1;
}
Re: A few questions about Pawno -
iRage - 13.06.2012
pawn Код:
COMMAND:usecrack(playerid, params[])
{
if(Crack[playerid] != 1) SendClientMessage(playerid,COLOR_WHITE, "You don't have any crack!");
else
{
SetPlayerHealth(playerid,100);
return 1;
}
Your code wouldn't work though due to missing some }'s, use the following, it even looks neater
pawn Код:
COMMAND:usecrack(playerid, params[])
{
if(Crack[playerid] != 1)
{
SendClientMessage(playerid,COLOR_WHITE, "You don't have any crack!");
}
else
{
SetPlayerHealth(playerid,100);
}
return 1;
}
Re: A few questions about Pawno -
Mike97300 - 13.06.2012
I see, thanks! And should I put the
On top of the script?
Also, how do you add one number for example, if you buy crack, it would increase the number by one so you could use it.
And my last two questions, how do you save the players number after they log off so they don't get reset to 0 when they log back in? Thanks.
Re: A few questions about Pawno -
Elysian` - 13.06.2012
Ahh you need a saving/loading system, go look in the tutorials there is one made my Kush..
also you use (to add a number):
NOTE: We don't use 2 " = " because we are not checking if they have that number.
Re: A few questions about Pawno -
Mike97300 - 13.06.2012
Now, would this work?
Код:
COMMAND:usecrack(playerid, params[])
{
if (crack != 1)
{
SendClientMessage(playerid,COLOR_WHITE, "You don't have any crack!");
}
else
{
SetPlayerHealth(playerid,100);
(crack -=1);
}
return 1;
}
Код:
COMMAND:buycrack(playerid, params[])
{
(crack +=1);
return 1;
}
I just made it, and I'm guessing the way that works is it does it for everyone, how do I make it for a specific player?
And when I use this
Код:
Crack[playerid] = 1;
I get errors saying that it is not defined etc.
Re: A few questions about Pawno -
Elysian` - 13.06.2012
EDIT: I saw your edit above, Good job. ^^
Re: A few questions about Pawno -
MP2 - 13.06.2012
To check if they have crack:
pawn Код:
if(!somevar[playerid]) return SendClientMessage(playerid, COLOR_RED, "You do not have any crack.");
SetPlayerHealth(...);
somevar[playerid]--, // remove 1
To add crack replace -- with ++
Re: A few questions about Pawno -
Mike97300 - 13.06.2012
EDIT: Never mind, the crack thing was an experiment for my project which is this so far.
Код:
new
FactionLeader = 1;
My command
Код:
COMMAND:makeleader(playerid, params[])
{
new giveplayerid, reason[24], string[125], name[24], name2[24];
if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
new targetid;
if(sscanf(params, "is[24]", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /makeleader [PlayerID/PartOfName]");
else if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,WHITE,"[ERROR] Player Is Not Connected");
else
{
GetPlayerName(giveplayerid, name, sizeof(name));
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof(string), "%s has given %s faction leadership!", name2, name, giveplayerid);
SendClientMessage(targetid,COLOR_GREEN, string);
(FactionLeader,targetid, += 1);
}
return 1;
}
I get the following errors
Код:
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(1031) : error 029: invalid expression, assumed zero
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(1031) : error 029: invalid expression, assumed zero
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(1031) : warning 215: expression has no effect
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(2296) : warning 203: symbol is never used: "FactionLeader"
I have no idea whats wrong with it, I overlooked it and fixed a few errors, also, how do I make it so the person that ID I put get's it increased and not you?