Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: mrockxkingbutt on December 11, 2013, 01:01:34 am

Title: Spawnloc [ First Time Introduce In Pawn ]
Post by: mrockxkingbutt on December 11, 2013, 01:01:34 am
Beggining
Code: [Select]
new SpawnLoc[MAX_PLAYERS];
In OnPlayerSpawn

Code: [Select]
if (SpawnLoc[playerid] == 1) {
     new splitx[ 3 ][ 128 ], szMsg[128];
    format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
    split( dini_Get( file, "SpawnLoc" ), splitx, ' ' );
    SetPlayerPos( playerid, floatstr( splitx[ 0 ] ), floatstr( splitx[ 1 ] ), floatstr( splitx[ 2 ] ), 0, 0 );
    format( szMsg, sizeof( szMsg ), "Teleporting to SavedLocation" );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}

Now Commands

Code: [Select]
    else if ( strcmp( cmd, "spawnlocset", true ) == 0 )
{
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else
{
new szMsg[ 128 ], axcont[ 128 ], Float:x, Float:y, Float:z;
format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );

  GetPlayerPos( playerid, x, y, z );

  format( axcont, 128, "%.5f %.5f %.5f", x, y, z );

dini_Create( file );
dini_Set( file, "Spawnloc", axcont );
   
SpawnLoc[playerid] = 1;   
   
format( szMsg, sizeof( szMsg ), "New Spawnloc Saved");
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
    }
 else if ( strcmp( cmd, "spawnlocoff", true ) == 0 )
 {
 SpawnLoc[playerid] = 0;
 SendClientMessage(playerid,COLOR_RED," Your SpawnLoc Is Offline ");
 return 1;
 } 

Credits : Tutorial Of Gups & 70 % By Me!
I Hope You Like It!
Please Comment!
+1 If You Like it!