OnPlayerRequestSpawn Help
#1

PHP код:
//==========================Spawn Request Stuff=================================
public OnPlayerRequestSpawn(playerid) {
       if(
PlayerInfo[playerid][Level] < 1) {
       if(
GetPlayerSkin(playerid) == 217) { SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); return 0; }
       if(
GetPlayerSkin(playerid) == 211) { SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); return 0; }
       }
       if(
GetPlayerName(playerid) == "Morand") {
           if(
GetPlayerSkin(playerid) == 59) {
               
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
               
SendClientMessage(playerid,green,"Welcome Back Boss Morand");
               return 
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
        }
    } else return 
SendClientMessage(playerid,red,"You Are Not Morand To Use This Skin");
       return 
1;

I found this error >
Код:
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21869) : warning 202: number of arguments does not match definition
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21869) : warning 202: number of arguments does not match definition
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21869) : error 033: array must be indexed (variable "-unknown-")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

1. You can't compare strings like that.
2. Your syntax for GetPlayerName was wrong. See Here: https://sampwiki.blast.hk/wiki/GetPlayerName
PHP код:
public OnPlayerRequestSpawn(playerid) {
       if(
PlayerInfo[playerid][Level] < 1) {
       if(
GetPlayerSkin(playerid) == 217) { SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); return 0; }
       if(
GetPlayerSkin(playerid) == 211) { SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); return 0; }
       }
       new 
name[MAX_PLAYER_NAME];
       
GetPlayerName(playeridnameMAX_PLAYER_NAME);
       if(!
strcmp(name"Morand"falseMAX_PLAYER_NAME)) {
           if(
GetPlayerSkin(playerid) == 59) {
               
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
               
SendClientMessage(playerid,green,"Welcome Back Boss Morand");
               return 
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
        }
    } else return 
SendClientMessage(playerid,red,"You Are Not Morand To Use This Skin");
       return 
1;

Reply
#3

I fixed your code up a little bit for you as well.

PHP код:
public OnPlayerRequestSpawn(playerid)
{
    if(
PlayerInfo[playerid][Level] < 1)
     {
        if(
GetPlayerSkin(playerid) == 217 || GetPlayerSkin(playerid) == 211) return SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin");
           new 
playername[MAX_PLAYER_NAME];
           
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
           if(!
strcmp(playername"Morand"falseMAX_PLAYER_NAME))
        {
             if(
GetPlayerSkin(playerid) == 59)
               {
                
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
                   
SendClientMessage(playerid,green,"Welcome Back Boss Morand");
                   
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
            }
        }
        else
        {
             return 
SendClientMessage(playerid,red,"You Are Not Morand To Use This Skin");
        }
    }
    return 
1;

Reply
#4

Код:
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21869) : warning 219: local variable "name" shadows a variable at a preceding level
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21870) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21871) : error 035: argument type mismatch (argument 1)
D:\Data\Filbert\SA-MP Server\SATDM\gamemodes\SATDM.pwn(21869) : warning 204: symbol is assigned a value that is never used: "name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#5

Can you show the lines 21870 and 21871?


This should fix the shadowing error:
PHP код:
public OnPlayerRequestSpawn(playerid) {
       if(
PlayerInfo[playerid][Level] < 1) {
       if(
GetPlayerSkin(playerid) == 217) { SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); return 0; }
       if(
GetPlayerSkin(playerid) == 211) { SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); return 0; }
       }
       new 
pname[MAX_PLAYER_NAME];
       
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
       if(!
strcmp(pname"Morand"falseMAX_PLAYER_NAME)) {
           if(
GetPlayerSkin(playerid) == 59) {
               
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
               
SendClientMessage(playerid,green,"Welcome Back Boss Morand");
               return 
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
        }
    } else return 
SendClientMessage(playerid,red,"You Are Not Morand To Use This Skin");
       return 
1;

Reply
#6

If my name is Tester, I can spawn with Morand skin.
I want it to be like "only me can use that skin."
Sorry for my bad english xD
Reply
#7

PHP код:
public OnPlayerRequestSpawn(playerid) {
       if(
PlayerInfo[playerid][Level] < 1) {
          if(
GetPlayerSkin(playerid) == 217 || GetPlayerSkin(playerid) == 211) { 
            
SendClientMessage(playerid,red,"You Must Be An Admin To Use This Skin"); 
            return 
0
          }
        }
       new 
pname[MAX_PLAYER_NAME];
       
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
       if(!
strcmp(pname"Morand"falseMAX_PLAYER_NAME)) {
           if(
GetPlayerSkin(playerid) == 59) {
               
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
               
SendClientMessage(playerid,green,"Welcome Back Boss Morand");
               
SendClientMessage(playerid,green,"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
        }
    } else{
        
SendClientMessage(playerid,red,"You Are Not Morand To Use This Skin");
        return 
0;
    }
    return 
1;

This should work.

According to this code, If your name is Morand, You will be able to spawn with the skin. Others won't be able to spawn with this skin
Reply
#8

IT'S WORKING! THANKS DarkSkull !

+REP FOR YOU!

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)