27.09.2014, 14:19
- How to check if the player is writing an integer or normal text??
Hello Guys! I wanna know how to check if the player is writing an integer to save this integer in a specific player's variable.
Example: (I know the code is kinda wrong a lil bit, but it's just an explanation!)
Hello Guys! I wanna know how to check if the player is writing an integer to save this integer in a specific player's variable.
Example: (I know the code is kinda wrong a lil bit, but it's just an explanation!)
pawn Код:
new Amount[MAX_PLAYERS];
new bool: IsWritingAmount[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
if(IsWritingAmount[playerid] == true)
{
if(strval(text) == text)
{
new string[50];
Amount[playerid] = text; // Consider the text was "300"
format(string, sizeof(string), "You have purchased %i of this thing for some money.", text); //%i would be 300
SendClientMessage(playerid, -1, string);
}
return 0;
}
else // if the player writes normal text
{
SendClientMessage(playerid, -1, "You should only write an integer at the moment to purchase an amount.")
return 0;
}
return 1;
}


