Premium help
#1

Hai all i needed help formating a part of my premium thing

pawn Код:
COMMAND:pslap(playerid,params,cmdtext[]) {
        new pId;
        if(isprem[pId]==1) return SendClientMessage(playerid, COLOR_RED, "You used /pslap");
        {
        else
        }
        (isprem[pId]==0); SendClientMessage(playerid, COLOR_RED, "You arent a premium member");
        new idx,tmp[256];
        new sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
        new string [128];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pslap [playerid]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
        GetPlayerName(playerid, sendername, sizeof(sendername));
        GetPlayerName(otherplayer, giveplayer, sizeof(giveplayer));
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(otherplayer, X, Y, Z);
        SetPlayerPos(otherplayer, X, Y, Z+10);
        format(string, sizeof(string), "\"%s\" was slapped by Admin \"%s\".", giveplayer, sendername);
        SendClientMessageToAll(COLOR_YELLOW, string);
        return 1;
}
But when i compile it gives these errors
pawn Код:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(342) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(344) : warning 215: expression has no effect
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(832) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
I mean 1 error but idk how to fix it
Reply
#2

What is line 342?
Reply
#3

line 342 =
pawn Код:
else
Reply
#4

EDIT: problem solved
Reply
#5

pawn Код:
COMMAND:pslap(playerid,params,cmdtext[]) {
        new pId;
        if(isprem[pId]==1) return SendClientMessage(playerid, COLOR_RED, "You used /pslap");
        {
        else
        {
        (isprem[pId]==0); SendClientMessage(playerid, COLOR_RED, "You arent a premium member");
        new idx,tmp[256];
        new sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
        new string [128];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pslap [playerid]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
        GetPlayerName(playerid, sendername, sizeof(sendername));
        GetPlayerName(otherplayer, giveplayer, sizeof(giveplayer));
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(otherplayer, X, Y, Z);
        SetPlayerPos(otherplayer, X, Y, Z+10);
        format(string, sizeof(string), "\"%s\" was slapped by Admin \"%s\".", giveplayer, sendername);
        SendClientMessageToAll(COLOR_YELLOW, string);
        }
        return 1;
}
Reply
#6

you're opening brackets that don't need to be there like
Код:
if(isprem[pId]==1) return SendClientMessage(playerid, COLOR_RED, "You used /pslap");
        {
and then you're putting an else after that bracket which doesn't make any sense with those brackets in there.
Reply
#7

pawn Код:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(283) : error 017: undefined symbol "sscanf"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(302) : error 017: undefined symbol "sscanf"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(342) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(344) : warning 215: expression has no effect
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(363) : warning 225: unreachable code
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(363) : warning 217: loose indentation
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(363) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(363) : error 017: undefined symbol "cmd_stuck"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(363) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(363) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Reply
#8

BUMP: I took away 2 brackets now i have
pawn Код:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(358) : error 010: invalid function or declaration
Line 358 =
pawn Код:
return 1;
Reply
#9

Oh added too many brackets
pawn Код:
COMMAND:pslap(playerid,params,cmdtext[])
{
        new pId;
        if(isprem[pId]==0) return SendClientMessage(playerid, COLOR_RED, "You arent a premium member");
else
        {
        new idx,tmp[256];
        new sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
        new string [128];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pslap [playerid]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
        GetPlayerName(playerid, sendername, sizeof(sendername));
        GetPlayerName(otherplayer, giveplayer, sizeof(giveplayer));
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(otherplayer, X, Y, Z);
        SetPlayerPos(otherplayer, X, Y, Z+10);
        format(string, sizeof(string), "\"%s\" was slapped by Admin \"%s\".", giveplayer, sendername);
        SendClientMessageToAll(COLOR_YELLOW, string);
        }
        return 1;
}
Reply
#10

I think it would work oliverrud but i have 2 warnings and its better to fix them too
pawn Код:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(342) : warning 217: loose indentation
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\BreakIn.pwn(832) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)