Basic question - removing entered value from variable
#1

pawn Код:
CMD:sell(playerid, params[])
{
    new Float:x,Float:y,Float:z;
    new string[128];
    new goldent;
    GetPlayerPos(playerid,x , y, z);
    if(sscanf(params,"i", goldent)) return SendClientMessage(playerid, -1, "usage...");
    if(!IsPlayerInRangeOfPoint(playerid, 7.0,x,y,z)) return SendClientMessage(playerid, -1, "Not in range!");
    GivePlayerMoney(playerid, 100*goldent);
    gold[playerid] - goldent;
    format(string, sizeof(string),"You have sold %i gold",goldent);
    SendClientMessage(playerid, -1, string);
    return 1;
}
how is it i get this warning

Код:
CMD:sell(playerid, params[])

C:\Users\Ross\Desktop\samp scripting\gamemodes\mining.pwn(54) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.


on line: gold[playerid] - goldent;
I want to remove the entered value, for example... /sell 2, I had 5, but have 3 left...
Reply
#2

Use -= to subtract a certain amount from a variable.

(Use += to add something, use -- to subtract 1 and ++ to add 1).

pawn Код:
gold[playerid] -= goldent;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)