[Help]
#1

Hello Every One i Get This Errors
Quote:

D:\ffff\gamemodes\fast.pwn(1374) : error 003: declaration of a local variable must appear in a compound block
D:\ffff\gamemodes\fast.pwn(1374) : error 017: undefined symbol "string"
D:\ffff\gamemodes\fast.pwn(1374) : warning 215: expression has no effect
D:\ffff\gamemodes\fast.pwn(1374) : error 001: expected token: ";", but found "]"
D:\ffff\gamemodes\fast.pwn(1374) : fatal error 107: too many error messages on one line

line 1374
PHP код:
    new string[128],targetid,Float:Heal,Pname[MAX_PLAYER_NAME],Iname[MAX_PLAYER_NAME]; 
Reply
#2

Remove Pname[MAX_PLAYER_NAME],Iname[MAX_PLAYER_NAME] and add them outside of the CMD. (I'm not sure tho)
Reply
#3

Show a bit more code.
Reply
#4

all code
PHP код:
CMD:sethp(playeridparams[])
{
    if(
PlayerInfo[playerid][pRank] == 2.6)
    new 
string[128],targetid,Float:Heal,Pname[MAX_PLAYER_NAME],Iname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,Pname,sizeof(Pname));
    
GetPlayerName(targetid,Iname,sizeof(Iname));
    if(
sscanf(params"ud"targetid,Heal))
    {
        
SendClientMessage(playerid,-1,"USAGE: /SetHealth (Player Name/ID) (Health)");
        return 
1;
    }
    if(!
IsPlayerConnected(targetid))
       {
        
format(string,sizeof(string),"The Player ID (%d) is not connected to the server. You cannot heal them.",targetid);
        
SendClientMessage(playerid,-1,string);
        return 
1;
        }
    
SetPlayerHealth(playerid,Heal);
    
format(string,sizeof(string),"You Have Set %s(%d) Health To %d",Iname,targetid,Heal);
    
SendClientMessage(playerid,-1,string);
    
format(string,sizeof(string),"%s(%d) Has Set Your Health To %d",Pname,playerid,Heal);
    
SendClientMessage(targetid,-1,string);
    
SetPlayerHealth(targetidhealth);
    }
    return 
1;

Reply
#5

Phew, the whole code is fucked up.
Here's a fix.
I have only fixed the errors, I didn't check wether the command actually works.
It should work though.

pawn Код:
CMD:sethp(playerid, params[], help)
{
    if(PlayerInfo[playerid][pRank] == 2.6) {
        new string[128],targetid,Float:Heal,Pname[MAX_PLAYER_NAME],Iname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,Pname,sizeof(Pname));
        GetPlayerName(targetid,Iname,sizeof(Iname));
        if(sscanf(params, "ud", targetid,Heal))
        {
            SendClientMessage(playerid,-1,"USAGE: /SetHealth (Player Name/ID) (Health)");
            return 1;
        }
        else if(!IsPlayerConnected(targetid))
        {
            format(string,sizeof(string),"The Player ID (%d) is not connected to the server. You cannot heal them.",targetid);
            SendClientMessage(playerid,-1,string);
            return 1;
        } else {
            SetPlayerHealth(playerid,Heal);
            format(string,sizeof(string),"You Have Set %s(%d) Health To %d",Iname,targetid,Heal);
            SendClientMessage(playerid,-1,string);
            format(string,sizeof(string),"%s(%d) Has Set Your Health To %d",Pname,playerid,Heal);
            SendClientMessage(targetid,-1,string);
            SetPlayerHealth(targetid, Heal);
        }
    }
    return 1;
}
Reply
#6

are you sure the problem is in this code?
pawn Код:
new string[128],targetid,Float:Heal,Pname[MAX_PLAYER_NAME],Iname[MAX_PLAYER_NAME];
Reply
#7

wtf i get much error in old cmd
Quote:

D:\ffff\gamemodes\fast.pwn(1419) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1419) : error 017: undefined symbol "cmd_vdestroy"
D:\ffff\gamemodes\fast.pwn(1419) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1419) : fatal error 107: too many error messages on one line

PHP код:
CMD:vdestroy(playeridparams[])
{
if(
PlayerInfo[playerid][pRank] == 2.6)
{
     new 
testcarGetPlayerVehicleID(playerid);
     
SendClientMessage(playerid0xFFFFFFFF"You have deleted a car!!");
     
DestroyVehicle(testcar);
     return 
1;

Reply
#8

Quote:
Originally Posted by astanalol
Посмотреть сообщение
wtf i get much error in old cmd

PHP код:
CMD:vdestroy(playeridparams[])
{
if(
PlayerInfo[playerid][pRank] == 2.6)
{
     new 
testcarGetPlayerVehicleID(playerid);
     
SendClientMessage(playerid0xFFFFFFFF"You have deleted a car!!");
     
DestroyVehicle(testcar);
     return 
1;

You are missing a bracket, fix:

pawn Код:
CMD:vdestroy(playerid, params[])
{
    if(PlayerInfo[playerid][pRank] == 2.6)
    {
        new testcar= GetPlayerVehicleID(playerid);
        SendClientMessage(playerid, 0xFFFFFFFF, "You have deleted a car!!");
        DestroyVehicle(testcar);
    }    
    return 1;
}
Reply
#9

still not working
Quote:

D:\ffff\gamemodes\fast.pwn(1419) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1419) : error 017: undefined symbol "cmd_vdestroy"
D:\ffff\gamemodes\fast.pwn(1419) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1419) : fatal error 107: too many error messages on one line

and this spawn Vehicle not there any errors in it
PHP код:
CMD:v(playeridparams[])
{
if(
PlayerInfo[playerid][pRank] == 2.6)
{
        new 
Vehicle[50];
        if(!
sscanf(params"s[50]"Vehicle))
        {
                new 
string[128], Float:Pos[4];
                
GetPlayerPos(playeridPos[0],Pos[1],Pos[2]); GetPlayerFacingAngle(playeridPos[3]);
                new 
veh GetVehicleModelID(Vehicle);
                if(
veh 400 || veh 611) return SendClientMessage(playeridCOLOR_RED"This is not a valid vehicle name! Please try again ");
                if(
IsPlayerInAnyVehicle(playerid)) { DestroyVehicle(GetPlayerVehicleID(playerid)); }
                
GetXYInFrontOfPlayer(playeridPos[0], Pos[1], 5);
                new 
PVeh CreateVehicle(vehPos[0], Pos[1], Pos[2], Pos[3]+90, -1, -1, -1);
                
LinkVehicleToInterior(PVehGetPlayerInterior(playerid)); SetVehicleVirtualWorld(PVehGetPlayerVirtualWorld(playerid));
                
format(stringsizeof string"You spawned a %s. ID: %i. "aVehicleNames[veh 400], veh);
                
SendClientMessage(playeridCOLOR_GREENstring);
        } else return 
SendClientMessage(playeridCOLOR_GREEN"Usage: /v [vehiclename] ");
        return 
1;

PHP код:
CMD:vdestroy(playeridparams[])
{
    if(
PlayerInfo[playerid][pRank] == 2.6)
    {
        new 
testcarGetPlayerVehicleID(playerid);
        
SendClientMessage(playerid0xFFFFFFFF"You have deleted a car!!");
        
DestroyVehicle(testcar);
    }
    return 
1;

only delete vehicle the errors
Reply
#10

Which line is 1419?
Edit:
There are too many fucked up things in both commands, I'd say just delete them both, start those commands over.
Make sure you're doing everything correctly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)