[Help]Error
#1

Help
Код:
C:\Users\ASUS\Desktop\nfs2.pwn(1533) : error 017: undefined symbol "tmp"
C:\Users\ASUS\Desktop\nfs2.pwn(1533) : error 017: undefined symbol "idx"
C:\Users\ASUS\Desktop\nfs2.pwn(1534) : error 017: undefined symbol "tmp"
C:\Users\ASUS\Desktop\nfs2.pwn(1539) : error 017: undefined symbol "giveplayerid"
C:\Users\ASUS\Desktop\nfs2.pwn(1539) : error 017: undefined symbol "giveplayer"
C:\Users\ASUS\Desktop\nfs2.pwn(1539) : error 029: invalid expression, assumed zero
C:\Users\ASUS\Desktop\nfs2.pwn(1539) : fatal error 107: too many error messages on one line
On Line

Код:
if(strcmp(cmdtext, "/goto", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "Използвай: /goto [Playerid/PartOfName]");
				return 1;
			}
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			new Float:plocx,Float:plocy,Float:plocz;
			new plo;
			plo = ReturnUser(tmp);
			if (IsPlayerConnected(plo))
			{
			    if(plo != INVALID_PLAYER_ID)
			    {
                        {
						GetPlayerPos(plo, plocx, plocy, plocz);
						SetPlayerInterior(playerid, GetPlayerInterior(plo));
						SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(plo));
						if (GetPlayerState(playerid) == 2)
						{
							new tmpcar = GetPlayerVehicleID(playerid);
							SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
							TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
						}
						else
						{
							SetPlayerPos(playerid,plocx,plocy+2, plocz);
						}
				        SendClientMessage(plo, COLOR_WHITE, string);
				        SendClientMessage(playerid, COLOR_WHITE, string);
					}
				}
			}
			else
			{
				format(string, sizeof(string), "ID-то, което посочи не е в сървъра.");
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#2

Don't copy-paste code you don't understand. That's where this errors come from.

The errors refer to the fact that none of those variables have been made.

Quote:
Originally Posted by sa-mp_wiki
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[30];
    new 
idx;
    
cmd strtok(cmdtextidx);
 
    if(
strcmp(cmd"/sayhello"true) == 0)
    {
        new 
tmp[30];
        
// assign the id (written by the user) to tmp
        
tmp strtok(cmdtextidx);
 
        
// convert the id to an integer using strval (this is essential)
        // and assign to otherplayer
        
new otherplayer strval(tmp);
 
        if(
IsPlayerConnected(otherplayer))
        {
            
SendClientMessage(otherplayer0xFFFF00AA"Hi, hello!");
        }
        return 
1;
    }
    return 
0;

This is just an example of SOME of what you are missing, the giveplayerid and giveplayer should just be a case of making a "new giveplayerid, giveplayer;" line in the command.
Reply
#3

I recommend you to use ZCMD. Making commands with ZCMD it's pretty easy and understable.
Reply
#4

The variables doesn't exist. This is the error. If you have copy/pasted the command, you're missing some information. Look after the line OnPlayerEnterCommand and search for the missing vars.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)