Help Me I Forgot The Code
#1

Код:
if(pickupid == MyPickup4) {
	Create3DTextLabel( "Vault", 0xFFFF00AA, 2455.6977,-1706.8764,1013.5078, 50.0, 0, 1 );
	if(!IsPlayerAdmin(playerid))
		{
		    GameTextForPlayer(playerid, "~r~Hardcore Cookie Is Only Allowed In", 5000, 5);
		    SendClientMessage(playerid,0xFF0006FF,"Hardcore_Cookie Is Only Allowed In");
		}
		else
		{
		    SetPlayerPos(playerid, 2144.3212,1627.8958,993.5761);
		    SetPlayerInterior(playerid, 1);
      		GameTextForPlayer(playerid, "~g~Welcome ~y~To ~p~Your ~b~Vault", 5000, 5);
		    SendClientMessage(playerid,COLOR_YELLOW,"Welcome To Your Vault");
  		}
	}




and uhm on the else bit i want it to say their name and they have entered for example
Код:
%s has entered the vault
but whats the code to do it thanks
Reply
#2

pawn Код:
new Name[MAX_PLAYER_NAME],String[MAX_PLAYERS];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(String, sizeof(String), "%s entered the vault.",Name);
    SendClientMessageToAll(0xBFBFBFFF, String);
Reply
#3

damn 4errors


Код:
C:\Users\Stephen\Desktop\serv\gamemodes\cookieserver.pwn(833) : warning 219: local variable "Name" shadows a variable at a preceding level
C:\Users\Stephen\Desktop\serv\gamemodes\cookieserver.pwn(835) : error 017: undefined symbol "String"
C:\Users\Stephen\Desktop\serv\gamemodes\cookieserver.pwn(835) : error 017: undefined symbol "String"
C:\Users\Stephen\Desktop\serv\gamemodes\cookieserver.pwn(835) : error 029: invalid expression, assumed zero
C:\Users\Stephen\Desktop\serv\gamemodes\cookieserver.pwn(835) : fatal error 107: too many error messages on one line
Reply
#4

Add new String[MAX_PLAYERS]; beside, Name[MAX_PLAYERS];

So it would look like this:

pawn Код:
new Name[MAX_PLAYER_NAME],String[MAX_PLAYERS];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(String, sizeof(String), "%s entered the vault.",Name);
    SendClientMessageToAll(0xBFBFBFFF, String);
And for this:
pawn Код:
warning 219: local variable "Name" shadows a variable at a preceding level
it means you have defined "Name" somewhere else in your script, i suggest keep all the variables at the top of your script.
Reply
#5

Quote:
Originally Posted by Tee
Посмотреть сообщение
Add new String[MAX_PLAYERS]; beside, Name[MAX_PLAYERS];

So it would look like this:

pawn Код:
new Name[MAX_PLAYER_NAME],String[MAX_PLAYERS];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(String, sizeof(String), "%s entered the vault.",Name);
    SendClientMessageToAll(0xBFBFBFFF, String);
Код:
C:\Users\Stephen\Desktop\serv\gamemodes\cookieserver.pwn(833) : warning 219: local variable "Name" shadows a variable at a preceding level
i just checked i havent got another new in my script of name
Reply
#6

And for this:
pawn Код:
warning 219: local variable "Name" shadows a variable at a preceding level
it means you have defined "Name" somewhere else in your script, i suggest keep all the variables at the top of your script.

And if you want to fix that just press ctrl+f and search for new Name[MAX_PLAYERS] and delete it, then put it at the top of your script, to avoid warning like this, i suggest keep all the variables at the top of your script.

Instead of making a new variable each time u need them, like "strings" which we use most, the best thing to do is define them at the top of your script,between the #includes and the #defines.
Reply
#7

Quote:
Originally Posted by Tee
Посмотреть сообщение
And for this:
pawn Код:
warning 219: local variable "Name" shadows a variable at a preceding level
it means you have defined "Name" somewhere else in your script, i suggest keep all the variables at the top of your script.

And if you want to fix that just press ctrl+f and search for new Name[MAX_PLAYERS] and delete it, then put it at the top of your script, to avoid warning like this, i suggest keep all the variables at the top of your script.

Instead of making a new variable each time u need them, like "strings" which we use most, the best thing to do is define them at the top of your script.
thanks i fixed it
Reply
#8

No problem, happy that i could help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)