19.10.2013, 13:24
Hi I have VIP Room. And this is basically for vip members. But I also want to invite players who are not vip players in the room. Can you please make demo script for this? thanks alot!
new
bool:PlayerInvitedPlayer [ MAX_PLAYERS ]
;
CMD:invite(playerid, params[])
{
new
targetid
;
if(sscanf(params, "u", targetid))
return SendClientMessage(playerid, -1, "Syntax: /invite [Player Name/ID]")
SetPlayerCheckpoint( targetid, PositionX, PositionY, PositionZ, CheckpointSize ) //VIP Entrance Position
PlayerInvitedPlayer[playerid] = true;
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(PlayerInvitedPlayer[playerid] == true)
{
SetPlayerPos(playerid, PositionX, PositionY, PositionZ)//Inside VIP Position
SetPlayerInterior(playerid, InteriorID)//VIP Interior ID
DisablePlayerCheckpoint(playerid);
}
return 1;
}
Quick example
pawn Код:
|
error 017: undefined symbol "PositionX" error 017: undefined symbol "PositionX" error 017: undefined symbol "InteriorID"
SetPlayerPos(playerid, PositionX, PositionY, PositionZ)
public OnPlayerEnterCheckpoint(playerid) { if(PlayerInvitedPlayer[playerid] == true) { SetPlayerPos(playerid, PositionX, PositionY, PositionZ)//Inside VIP Position SetPlayerInterior(playerid, InteriorID)//VIP Interior ID DisablePlayerCheckpoint(playerid); } return 1; }
-710.6376,1851.7188,8.7459
Wow thanks alot for responding.. Anyway I got this warnings..
Код:
error 017: undefined symbol "PositionX" error 017: undefined symbol "PositionX" error 017: undefined symbol "InteriorID" Код:
SetPlayerPos(playerid, PositionX, PositionY, PositionZ) Код:
public OnPlayerEnterCheckpoint(playerid) { if(PlayerInvitedPlayer[playerid] == true) { SetPlayerPos(playerid, PositionX, PositionY, PositionZ)//Inside VIP Position SetPlayerInterior(playerid, InteriorID)//VIP Interior ID DisablePlayerCheckpoint(playerid); } return 1; } Код:
-710.6376,1851.7188,8.7459 |
Try changing them your own, you need to learn something, you are high roller. |
CMD:invite(playerid, params[]) { new targetid ; if(sscanf(params, "u",targetid)) return SendClientMessage(playerid, yellow, "Usage: /invite <Part of Nick/Player ID>"); GameTextForPlayer(playerid,"~y~Welcome to ~n~~b~VIP Room",2000,3); SetPlayerPos(playerid, -710.6376,1851.7188,8.7459); SetPlayerFacingAngle(playerid, 270); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 20); SetCameraBehindPlayer(playerid); DestroyVehicle(GetPlayerVehicleID(playerid)); PlayerInvitedPlayer[playerid] = true; return 1; }
public OnPlayerEnterCheckpoint(playerid) { if(PlayerInvitedPlayer[playerid] == true) { SetPlayerPos(playerid, -710.6376,1851.7188,8.7459);//Inside VIP Position DisablePlayerCheckpoint(playerid); } return 1; }
I got it working now...
Код:
CMD:invite(playerid, params[]) { new targetid ; if(sscanf(params, "u",targetid)) return SendClientMessage(playerid, yellow, "Usage: /invite <Part of Nick/Player ID>"); GameTextForPlayer(playerid,"~y~Welcome to ~n~~b~VIP Room",2000,3); SetPlayerPos(playerid, -710.6376,1851.7188,8.7459); SetPlayerFacingAngle(playerid, 270); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 20); SetCameraBehindPlayer(playerid); DestroyVehicle(GetPlayerVehicleID(playerid)); PlayerInvitedPlayer[playerid] = true; return 1; } Код:
public OnPlayerEnterCheckpoint(playerid) { if(PlayerInvitedPlayer[playerid] == true) { SetPlayerPos(playerid, -710.6376,1851.7188,8.7459);//Inside VIP Position DisablePlayerCheckpoint(playerid); } return 1; } |
new
bool:_pInvitedSomeone [ MAX_PLAYERS char ]
;
CMD:invite(playerid, params[])
{
new
targetid,
_string [ 90 ],
_PlayerName [ 24 ]
;
if(sscanf(params, "u",targetid)) return SendClientMessage(playerid, yellow, "Usage: /invite <Part of Nick/Player ID>");
GetPlayerName(playerid, _PlayerName, sizeof(_PlayerName));
format(_string, sizeof(_string), "%s has invited you to the VIP, use (/accept) or (/decline)",_PlayerName);
_pInvitedSomeone{targetid} = true;
return 1;
}
CMD:accept(playerid, params[])
{
if( !_pInvitedSomeone { playerid } ) return SendClientMessage(playerid, -1, "Error - No One invited you! ");
if( _pInvitedSomeone { playerid } ) // means true
{
GameTextForPlayer(playerid,"~y~Welcome to ~n~~b~VIP Room",2000,3);
SetPlayerPos(playerid, -710.6376,1851.7188,8.7459), SetPlayerFacingAngle(playerid, 270),
SetPlayerInterior(playerid, 0), SetPlayerVirtualWorld(playerid, 20);
SetCameraBehindPlayer(playerid), DestroyVehicle(GetPlayerVehicleID(playerid));
_pInvitedSomeone{playerid} = false;
}
return 1;
}
CMD:decline(playerid, params[])
{
if( !_pInvitedSomeone { playerid } ) return SendClientMessage(playerid, -1, "Error - No One invited you! ");
if( _pInvitedSomeone { playerid } )
{
SendClientMessage(playerid, -1, "You have succesfully declined the VIP Invite.");
_pInvitedSomeone{playerid} = false;
}
return 1;
}
Remove the command and the variable I gave you, and change it with this
pawn Код:
|
[19:02:50] [debug] Run time error 4: "Array index out of bounds" [19:02:50] [debug] Accessing element at index 65535 past array upper bound 499 [19:02:50] [debug] AMX backtrace: [19:02:50] [debug] #0 000d1ff0 in public cmd_vinvite (playerid=0, params[]=@0x0115e260 "1") at C:\Users\Kevs\Desktop\A\test\filterscripts\JLadmin.pwn:15488 [19:02:50] [debug] #1 native CallLocalFunction () [00471ef0] from samp-server.exe [19:02:50] [debug] #2 000206a4 in ?? (... <2 arguments>) at C:\Users\Kevs\Desktop\A\test\pawno\include\zcmd.inc:110 [19:02:50] [debug] #3 00006ae0 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x0115e234 "/vinvite 1") at C:\Users\Kevs\Desktop\A\test\pawno\include\YSI\y_hooks/impl.inc:918
if( variable_name_here != INVALID_PLAYER_ID )
{
// variable_name_here is the one was set to INVALID_PLAYER_ID and it got passed into the index.
// now you can insert that variable into array
}
if(!IsPlayerConnected(playerid)) continue;
if(targetid != INVALID_PLAYER_ID)
{
// code here
}