New command, needs a fix
#1

Anyhow, I built a script that allows a player to advertise everything that he wants, seems like everything works, besides the advertise it's self, when I get to the place It shots "Unknown command " and You are not near the Advertisement building ! can any one take a look ? It should be ad that everyone can see.
PHP код:
if(strcmp("/ad"cmdtexttrue6) == 0)
{
static 
ad;
new 
iName[MAX_PLAYER_NAME+1];
new 
cmd[256];
new    
tmp[256];
new    
idx;
cmd strtok(cmdtextidx);
if(!
strlen(tmp) || strlen(tmp) > 5) {
            
SendClientMessage(playerid,0xAFAFAFAA,"Usage: /ad (message)");
            return 
1;
        }
GetPlayerName(playerid,iName,sizeof(iName));
if(
IsPlayerConnected(playerid))
 if(
IsPlayerInRangeOfPoint(playerid501729.6362,-1277.4733,13.5468))
 if(!
ad)
 
GivePlayerMoney(playerid, -1000);
 
SendClientMessageToAll(0x52ED07FF"[Advertisement] %s %s");
  return 
1;
            }
            else { 
SendClientMessage(playerid0xFF4646FF,"You are not near the Advertisement building !"); }
        
        return 
0;

Reply
#2

You know what? I'm sick of you coming here every 10 seconds with a new problem. Look into things yourself! It helps by comparing your code to a code in a working GM - not stealing the code. If that doesn't help, you need to take a look at the SA-MP Wiki. I understand this is the "scripting discussion" board, but please at least attempt to solve issues on your own. I have seen your code and a lot of it (maybe not this) looks like it's missing large pieces.
Reply
#3

Use SSCANF
Reply
#4

Realcop, I looked into it, I'm not stealing codes, I'm trying to learn by asking you, I just started this week.
Can you help me ?
Reply
#5

I didn't say you were stealing code. "It helps by comparing your code to a code in a working GM - not stealing the code." - meaning you should look at another GM's command or whatever and compare it to yours. Just do not steal the code instead of fixing your own.

Like "The_Moddler" said, use SSCANF(2).
Reply
#6

........
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)